﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SmartMathLibrary.Simulation.LogicalGate
{
    /// <summary>
    /// This class represents an logical XNOR gate.
    /// </summary>
    [Serializable]
    public class XNORGate : TwoInputGate
    {
        /// <summary>
        /// Gets the logical result, which is defined by the gate and the specified input values.
        /// </summary>
        /// <returns>The result of the logical gate.</returns>
        public override Byte GetResult()
        {
            Byte result = new Byte();

            for (int i = 0; i < 8; i++)
            {
                result.Bits[i].State = !(this.A.Bits[i].State ^ this.B.Bits[i].State);
            }

            return result;
        }
    }
}